﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using C1.Win.C1Input;
    using Excel;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptChiTietCongNo : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("AdvKhachHang")]
        private ADVObjects _AdvKhachHang;
        [AccessedThroughProperty("AdvTaiKhoan")]
        private ADVAccount _AdvTaiKhoan;
        [AccessedThroughProperty("CmdExel")]
        private System.Windows.Forms.Button _CmdExel;
        [AccessedThroughProperty("CmdLoad")]
        private System.Windows.Forms.Button _CmdLoad;
        [AccessedThroughProperty("CmdPrint")]
        private System.Windows.Forms.Button _CmdPrint;
        [AccessedThroughProperty("Label1")]
        private System.Windows.Forms.Label _Label1;
        [AccessedThroughProperty("Label16")]
        private System.Windows.Forms.Label _Label16;
        [AccessedThroughProperty("Label2")]
        private System.Windows.Forms.Label _Label2;
        [AccessedThroughProperty("Label4")]
        private System.Windows.Forms.Label _Label4;
        [AccessedThroughProperty("Label5")]
        private System.Windows.Forms.Label _Label5;
        [AccessedThroughProperty("Label6")]
        private System.Windows.Forms.Label _Label6;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("Panel3")]
        private Panel _Panel3;
        [AccessedThroughProperty("Panel4")]
        private Panel _Panel4;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtTongPhatSinhCo")]
        private C1NumericEdit _TxtTongPhatSinhCo;
        [AccessedThroughProperty("TxtTongPhatSinhNo")]
        private C1NumericEdit _TxtTongPhatSinhNo;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;

        [DebuggerNonUserCode]
        public Frm_RptChiTietCongNo()
        {
            base.FormClosing += new FormClosingEventHandler(this.Frm_RptChiTietCongNo_FormClosing);
            base.Load += new EventHandler(this.Frm_RptChiTietCongNo_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdExel_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog dialog = new SaveFileDialog {
                    Filter = "Excel Files|*.xls",
                    Title = "Save an Excel file"
                };
                dialog.ShowDialog();
                if (dialog.FileName != "")
                {
                    this.VSlist.SaveExcel(dialog.FileName, "CongNo", FileFlags.IncludeFixedCells);
                    Excel.Application application = new ApplicationClass();
                    Workbook workbook = application.Workbooks.Open(dialog.FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
                    application.Visible = true;
                }
            }
            catch (COMException exception1)
            {
                ProjectData.SetProjectError(exception1);
                COMException exception = exception1;
                MessageBox.Show(exception.Message);
                ProjectData.ClearProjectError();
            }
            catch (Exception exception3)
            {
                ProjectData.SetProjectError(exception3);
                Exception exception2 = exception3;
                MessageBox.Show(exception2.Message);
                ProjectData.ClearProjectError();
            }
        }

        private void CmdLoad_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_RptChiTietCongNo_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Dispose();
        }

        private void Frm_RptChiTietCongNo_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
                this.TxtDenNgay.Text = Strings.Format(DateAndTime.Today, "dd/MM/yyyy");
                LVYModule.advFormatNumber(this.TxtTongPhatSinhNo, modGeneral.H_FORMATNUMBER);
                LVYModule.advFormatNumber(this.TxtTongPhatSinhCo, modGeneral.H_FORMATNUMBER);
                this.AdvTaiKhoan.SetDefault();
                this.LoadData();
                this.Cursor = Cursors.Default;
            }
        }

        public System.Data.DataTable GetDataCongNoChiTietHanThanhToan()
        {
            System.Data.DataTable table;
            clsDMTaiKhoan khoan = new clsDMTaiKhoan();
            string strKhoaCha = this.AdvTaiKhoan.Value;
            string listKhoaTaiKhoanCon = khoan.GetListKhoaTaiKhoanCon(strKhoaCha);
            IDataParameter[] commandParameters = new IDataParameter[8];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@TuNgay", DbType.Int64, ParameterDirection.Input, LVYModule.Date2Char(this.TxtTuNgay.Text));
                commandParameters[1] = DBHelper.createParameter("@DenNgay", DbType.Int64, ParameterDirection.Input, LVYModule.Date2Char(this.TxtDenNgay.Text));
                commandParameters[2] = DBHelper.createParameter("@KhoaTaiKhoan", DbType.Int64, ParameterDirection.Input, strKhoaCha);
                commandParameters[3] = DBHelper.createParameter("@KhoaBaoCao", DbType.Int64, ParameterDirection.Input, this.AdvKhachHang.Value);
                commandParameters[4] = DBHelper.createParameter("@Language", DbType.Int64, ParameterDirection.Input, modGeneral.H_LANGUAGE);
                commandParameters[5] = DBHelper.createParameter("@KhoaDonVi", DbType.Int64, ParameterDirection.Input, modGeneral.H_CLIENT);
                commandParameters[6] = DBHelper.createParameter("@ListKhoaTaiKhoan", DbType.Int64, ParameterDirection.Input, listKhoaTaiKhoanCon);
                commandParameters[7] = DBHelper.createParameter("@LoaiTien", DbType.Int64, ParameterDirection.Input, "VND");
                table = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.StoredProcedure, "GL_BC_ChiTietCongNoTheoHangHoa", commandParameters).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message);
                table = null;
                ProjectData.ClearProjectError();
                return table;
                ProjectData.ClearProjectError();
            }
            return table;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptChiTietCongNo));
            this.Label4 = new System.Windows.Forms.Label();
            this.TxtTongPhatSinhCo = new C1NumericEdit();
            this.Panel2 = new Panel();
            this.CmdLoad = new System.Windows.Forms.Button();
            this.CmdExel = new System.Windows.Forms.Button();
            this.TxtTongPhatSinhNo = new C1NumericEdit();
            this.Label16 = new System.Windows.Forms.Label();
            this.Label5 = new System.Windows.Forms.Label();
            this.Panel1 = new Panel();
            this.Label6 = new System.Windows.Forms.Label();
            this.Label2 = new System.Windows.Forms.Label();
            this.AdvTaiKhoan = new ADVAccount();
            this.CmdPrint = new System.Windows.Forms.Button();
            this.AdvKhachHang = new ADVObjects();
            this.Label1 = new System.Windows.Forms.Label();
            this.TxtDenNgay = new DateTimePicker();
            this.TxtTuNgay = new DateTimePicker();
            this.Panel4 = new Panel();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel3 = new Panel();
            ((ISupportInitialize) this.TxtTongPhatSinhCo).BeginInit();
            this.Panel2.SuspendLayout();
            ((ISupportInitialize) this.TxtTongPhatSinhNo).BeginInit();
            this.Panel1.SuspendLayout();
            this.Panel4.SuspendLayout();
            this.VSlist.BeginInit();
            this.Panel3.SuspendLayout();
            this.SuspendLayout();
            this.Label4.AutoEllipsis = true;
            this.Label4.AutoSize = true;
            this.Label4.BackColor = Color.Transparent;
            System.Drawing.Point point = new System.Drawing.Point(0x51, 0x1b);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            this.Label4.RightToLeft = RightToLeft.No;
            Size size = new Size(0x57, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 0x8a;
            this.Label4.Text = "Số dư nợ cuối kỳ";
            this.Label4.TextAlign = ContentAlignment.TopRight;
            this.TxtTongPhatSinhCo.BorderStyle = BorderStyle.FixedSingle;
            this.TxtTongPhatSinhCo.DataType = typeof(double);
            this.TxtTongPhatSinhCo.FormatType = FormatTypeEnum.Currency;
            point = new System.Drawing.Point(0xc7, 4);
            this.TxtTongPhatSinhCo.Location = point;
            this.TxtTongPhatSinhCo.Name = "TxtTongPhatSinhCo";
            Padding padding = new Padding(1);
            this.TxtTongPhatSinhCo.Padding = padding;
            this.TxtTongPhatSinhCo.ReadOnly = true;
            size = new Size(110, 20);
            this.TxtTongPhatSinhCo.Size = size;
            this.TxtTongPhatSinhCo.TabIndex = 0x88;
            this.TxtTongPhatSinhCo.Tag = null;
            this.TxtTongPhatSinhCo.TextAlign = HorizontalAlignment.Right;
            this.TxtTongPhatSinhCo.VisibleButtons = DropDownControlButtonFlags.None;
            this.TxtTongPhatSinhCo.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.TxtTongPhatSinhCo.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.Panel2.BackColor = Color.Transparent;
            this.Panel2.Controls.Add(this.CmdLoad);
            this.Panel2.Controls.Add(this.CmdExel);
            this.Panel2.Dock = DockStyle.Right;
            point = new System.Drawing.Point(0x326, 0);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0xbc, 0x2f);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 0x7a;
            this.CmdLoad.Image = (Image) manager.GetObject("CmdLoad.Image");
            this.CmdLoad.ImageAlign = ContentAlignment.MiddleLeft;
            point = new System.Drawing.Point(0x10, 0x11);
            this.CmdLoad.Location = point;
            this.CmdLoad.Name = "CmdLoad";
            size = new Size(0x53, 0x19);
            this.CmdLoad.Size = size;
            this.CmdLoad.TabIndex = 0x73;
            this.CmdLoad.Text = "Load";
            this.CmdLoad.UseVisualStyleBackColor = true;
            this.CmdExel.Image = (Image) manager.GetObject("CmdExel.Image");
            this.CmdExel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new System.Drawing.Point(100, 0x11);
            this.CmdExel.Location = point;
            this.CmdExel.Name = "CmdExel";
            size = new Size(0x53, 0x19);
            this.CmdExel.Size = size;
            this.CmdExel.TabIndex = 0x75;
            this.CmdExel.Text = "&Excel";
            this.CmdExel.UseVisualStyleBackColor = true;
            this.TxtTongPhatSinhNo.BorderStyle = BorderStyle.FixedSingle;
            this.TxtTongPhatSinhNo.DataType = typeof(double);
            this.TxtTongPhatSinhNo.FormatType = FormatTypeEnum.Currency;
            point = new System.Drawing.Point(0x54, 4);
            this.TxtTongPhatSinhNo.Location = point;
            this.TxtTongPhatSinhNo.Name = "TxtTongPhatSinhNo";
            padding = new Padding(1);
            this.TxtTongPhatSinhNo.Padding = padding;
            this.TxtTongPhatSinhNo.ReadOnly = true;
            size = new Size(0x71, 20);
            this.TxtTongPhatSinhNo.Size = size;
            this.TxtTongPhatSinhNo.TabIndex = 0x87;
            this.TxtTongPhatSinhNo.Tag = null;
            this.TxtTongPhatSinhNo.TextAlign = HorizontalAlignment.Right;
            this.TxtTongPhatSinhNo.VisibleButtons = DropDownControlButtonFlags.None;
            this.TxtTongPhatSinhNo.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.TxtTongPhatSinhNo.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.Label16.AutoEllipsis = true;
            this.Label16.AutoSize = true;
            this.Label16.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0xb8, 4);
            this.Label16.Location = point;
            this.Label16.Name = "Label16";
            this.Label16.RightToLeft = RightToLeft.No;
            size = new Size(0x41, 13);
            this.Label16.Size = size;
            this.Label16.TabIndex = 0x72;
            this.Label16.Text = "Kh\x00e1ch h\x00e0ng";
            this.Label16.TextAlign = ContentAlignment.TopRight;
            this.Label5.AutoEllipsis = true;
            this.Label5.AutoSize = true;
            this.Label5.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0xc4, 0x1b);
            this.Label5.Location = point;
            this.Label5.Name = "Label5";
            this.Label5.RightToLeft = RightToLeft.No;
            size = new Size(0x57, 13);
            this.Label5.Size = size;
            this.Label5.TabIndex = 0x8b;
            this.Label5.Text = "Số dư c\x00f3 cuối kỳ";
            this.Label5.TextAlign = ContentAlignment.TopRight;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.Label6);
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.AdvTaiKhoan);
            this.Panel1.Controls.Add(this.Panel2);
            this.Panel1.Controls.Add(this.CmdPrint);
            this.Panel1.Controls.Add(this.Label16);
            this.Panel1.Controls.Add(this.AdvKhachHang);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.TxtDenNgay);
            this.Panel1.Controls.Add(this.TxtTuNgay);
            this.Panel1.Dock = DockStyle.Top;
            point = new System.Drawing.Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x3e2, 0x2f);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x7e;
            this.Label6.AutoSize = true;
            this.Label6.BackColor = Color.Transparent;
            point = new System.Drawing.Point(3, 5);
            this.Label6.Location = point;
            this.Label6.Name = "Label6";
            size = new Size(0x2e, 13);
            this.Label6.Size = size;
            this.Label6.TabIndex = 0x7d;
            this.Label6.Text = "Từ ng\x00e0y";
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x1ef, 4);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x43, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x7c;
            this.Label2.Text = "Số t\x00e0i khoản";
            this.AdvTaiKhoan.Conditions = "";
            this.AdvTaiKhoan.DefaultValue = "131";
            this.AdvTaiKhoan.FieldNameFilter = "Left(SoTaiKhoan,3)";
            this.AdvTaiKhoan.KeyFilter = "131|141|338";
            point = new System.Drawing.Point(0x1f2, 20);
            this.AdvTaiKhoan.Location = point;
            padding = new Padding(0);
            this.AdvTaiKhoan.Margin = padding;
            this.AdvTaiKhoan.Name = "AdvTaiKhoan";
            this.AdvTaiKhoan.OnlyDigit = false;
            this.AdvTaiKhoan.ReadOnly = false;
            size = new Size(0x131, 20);
            this.AdvTaiKhoan.Size = size;
            this.AdvTaiKhoan.TabIndex = 0x7b;
            this.AdvTaiKhoan.UpperText = true;
            this.AdvTaiKhoan.Value = "";
            this.AdvTaiKhoan.WithCode = 80;
            this.CmdPrint.Image = ACCOUNTING.My.Resources.Resources.report;
            this.CmdPrint.ImageAlign = ContentAlignment.MiddleLeft;
            point = new System.Drawing.Point(0x33a, 0x2e);
            this.CmdPrint.Location = point;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x53, 0x19);
            this.CmdPrint.Size = size;
            this.CmdPrint.TabIndex = 0x74;
            this.CmdPrint.Text = "Trang in";
            this.CmdPrint.UseVisualStyleBackColor = true;
            this.AdvKhachHang.Conditions = "";
            this.AdvKhachHang.LoaiDoiTuong = modGeneral.TypeObjects.KhachHang;
            point = new System.Drawing.Point(0xbb, 20);
            this.AdvKhachHang.Location = point;
            this.AdvKhachHang.Name = "AdvKhachHang";
            this.AdvKhachHang.ReadOnly = false;
            size = new Size(0x12e, 20);
            this.AdvKhachHang.Size = size;
            this.AdvKhachHang.TabIndex = 0x71;
            this.AdvKhachHang.UpperText = true;
            this.AdvKhachHang.Value = "";
            this.AdvKhachHang.WidthCode = 80;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x5d, 4);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x35, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x3f;
            this.Label1.Text = "Đến ng\x00e0y";
            this.TxtDenNgay.Format = DateTimePickerFormat.Custom;
            point = new System.Drawing.Point(0x60, 20);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x55, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x3e;
            this.TxtTuNgay.Format = DateTimePickerFormat.Custom;
            point = new System.Drawing.Point(6, 20);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x53, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 60;
            this.Panel4.BackColor = Color.Transparent;
            this.Panel4.Controls.Add(this.Label5);
            this.Panel4.Controls.Add(this.Label4);
            this.Panel4.Controls.Add(this.TxtTongPhatSinhCo);
            this.Panel4.Controls.Add(this.TxtTongPhatSinhNo);
            this.Panel4.Dock = DockStyle.Right;
            point = new System.Drawing.Point(680, 0);
            this.Panel4.Location = point;
            this.Panel4.Name = "Panel4";
            size = new Size(0x13a, 0x2c);
            this.Panel4.Size = size;
            this.Panel4.TabIndex = 0x12;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new System.Drawing.Point(0, 0x2f);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.Rows.MaxSize = 0x12;
            this.VSlist.Rows.MinSize = 0x12;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x3e2, 0x216);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 0x7f;
            this.VSlist.VisualStyle = C1.Win.C1FlexGrid.VisualStyle.Office2007Blue;
            this.Panel3.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel3.Controls.Add(this.Panel4);
            this.Panel3.Dock = DockStyle.Bottom;
            point = new System.Drawing.Point(0, 0x245);
            this.Panel3.Location = point;
            this.Panel3.Name = "Panel3";
            size = new Size(0x3e2, 0x2c);
            this.Panel3.Size = size;
            this.Panel3.TabIndex = 0x80;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x3e2, 0x271);
            this.ClientSize = size;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel1);
            this.Controls.Add(this.Panel3);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MinimizeBox = false;
            this.Name = "Frm_RptChiTietCongNo";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-KT05";
            this.Text = "CONG NO PHAI THU CHI TIET";
            ((ISupportInitialize) this.TxtTongPhatSinhCo).EndInit();
            this.Panel2.ResumeLayout(false);
            ((ISupportInitialize) this.TxtTongPhatSinhNo).EndInit();
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.Panel4.ResumeLayout(false);
            this.Panel4.PerformLayout();
            this.VSlist.EndInit();
            this.Panel3.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            this.Cursor = Cursors.WaitCursor;
            System.Data.DataTable dataCongNoChiTietHanThanhToan = this.GetDataCongNoChiTietHanThanhToan();
            double num5 = 0.0;
            double num3 = 0.0;
            double num4 = 0.0;
            double num2 = 0.0;
            double num7 = 0.0;
            double num6 = 0.0;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            if (dataCongNoChiTietHanThanhToan.Rows.Count != 0)
            {
                string str = "";
                string str2 = "";
                vSlist.Tree.Style = TreeStyleFlags.CompleteLeaf;
                vSlist.Tree.Column = 0;
                int num8 = dataCongNoChiTietHanThanhToan.Rows.Count - 1;
                for (int i = 0; i <= num8; i++)
                {
                    if (str2.Trim() != dataCongNoChiTietHanThanhToan.Rows[i]["MaDoiTuong"].ToString().Trim())
                    {
                        num4 += num5;
                        num2 += num3;
                        if ((num2 > num3) | (num4 > num5))
                        {
                            vSlist.Rows.InsertNode(vSlist.Rows.Count, 2);
                            vSlist[vSlist.Rows.Count - 1, 0] = modGeneral.Tranlated("Số dư cuối kỳ", "");
                            if (num4 > num2)
                            {
                                num4 -= num2;
                                num2 = 0.0;
                            }
                            else
                            {
                                num2 -= num4;
                                num4 = 0.0;
                            }
                            vSlist[vSlist.Rows.Count - 1, 13] = num4;
                            vSlist[vSlist.Rows.Count - 1, 14] = num2;
                            LVYModule.SetColorForGrid(this.VSlist, Color.Khaki, vSlist.Rows.Count - 1, 0, 0, 0);
                        }
                        num5 = Conversions.ToDouble(dataCongNoChiTietHanThanhToan.Rows[i]["SoDuNoDK"]);
                        num3 = Conversions.ToDouble(dataCongNoChiTietHanThanhToan.Rows[i]["SoDuCoDK"]);
                        num4 = 0.0;
                        num2 = 0.0;
                        vSlist.Rows.InsertNode(vSlist.Rows.Count, 1);
                        vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["TenDoiTuong"]);
                        vSlist[vSlist.Rows.Count - 1, 13] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoDuNoDK"]);
                        vSlist[vSlist.Rows.Count - 1, 14] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoDuCoDK"]);
                        LVYModule.SetColorForGrid(this.VSlist, Color.DarkSeaGreen, vSlist.Rows.Count - 1, 0, 0, 0);
                    }
                    if (dataCongNoChiTietHanThanhToan.Rows[i]["KhoaChungTu"].ToString().Trim() != "")
                    {
                        if (str.Trim() != dataCongNoChiTietHanThanhToan.Rows[i]["KhoaChungTu"].ToString().Trim())
                        {
                            num4 += Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoPhatSinhNo"]));
                            num2 += Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoPhatSinhCo"]));
                            vSlist.Rows.InsertNode(vSlist.Rows.Count, 2);
                            vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["NgayChungTu"]);
                            vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoChungTu"]);
                            vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoHoaDon"]);
                            vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["DienGiai"]);
                            vSlist[vSlist.Rows.Count - 1, 13] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoPhatSinhNo"]);
                            vSlist[vSlist.Rows.Count - 1, 14] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoPhatSinhCo"]);
                            vSlist[vSlist.Rows.Count - 1, 15] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["HanThanhToan"]);
                            vSlist[vSlist.Rows.Count - 1, 0x10] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["DaThanhToan"]);
                            vSlist[vSlist.Rows.Count - 1, 0x11] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["NgayThuTien"]);
                            vSlist[vSlist.Rows.Count - 1, 0x12] = Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoPhatSinhNo"])) - Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["DaThanhToan"]));
                            vSlist[vSlist.Rows.Count - 1, 0x13] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["QuaHan"]);
                            LVYModule.SetColorForGrid(this.VSlist, Color.AliceBlue, vSlist.Rows.Count - 1, 0, 0, 0);
                            if (dataCongNoChiTietHanThanhToan.Rows[i]["MaHangHoa"].ToString().Trim() != "")
                            {
                                vSlist.Rows.InsertNode(vSlist.Rows.Count, 3);
                                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["TenHangHoa"]);
                                vSlist[vSlist.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoLuong"]);
                                vSlist[vSlist.Rows.Count - 1, 9] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["DonGia"]);
                                vSlist[vSlist.Rows.Count - 1, 10] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["ChietKhau"]);
                                vSlist[vSlist.Rows.Count - 1, 11] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["TienThue"]);
                                vSlist[vSlist.Rows.Count - 1, 12] = Microsoft.VisualBasic.CompilerServices.Operators.AddObject(Microsoft.VisualBasic.CompilerServices.Operators.SubtractObject(dataCongNoChiTietHanThanhToan.Rows[i]["ThanhTien"], dataCongNoChiTietHanThanhToan.Rows[i]["ChietKhau"]), dataCongNoChiTietHanThanhToan.Rows[i]["TienThue"]);
                            }
                        }
                        else
                        {
                            vSlist.Rows.InsertNode(vSlist.Rows.Count, 3);
                            vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["TenHangHoa"]);
                            vSlist[vSlist.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["SoLuong"]);
                            vSlist[vSlist.Rows.Count - 1, 9] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["DonGia"]);
                            vSlist[vSlist.Rows.Count - 1, 10] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["ChietKhau"]);
                            vSlist[vSlist.Rows.Count - 1, 11] = RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[i]["TienThue"]);
                            vSlist[vSlist.Rows.Count - 1, 12] = Microsoft.VisualBasic.CompilerServices.Operators.AddObject(Microsoft.VisualBasic.CompilerServices.Operators.SubtractObject(dataCongNoChiTietHanThanhToan.Rows[i]["ThanhTien"], dataCongNoChiTietHanThanhToan.Rows[i]["ChietKhau"]), dataCongNoChiTietHanThanhToan.Rows[i]["TienThue"]);
                        }
                    }
                    str = Conversions.ToString(dataCongNoChiTietHanThanhToan.Rows[i]["KhoaChungTu"]);
                    str2 = Conversions.ToString(dataCongNoChiTietHanThanhToan.Rows[i]["MaDoiTuong"]);
                }
                num4 += num5;
                num2 += num3;
                if ((num2 > num3) | (num4 > num5))
                {
                    vSlist.Rows.InsertNode(vSlist.Rows.Count, 2);
                    vSlist[vSlist.Rows.Count - 1, 0] = modGeneral.Tranlated("Số dư cuối kỳ", "");
                    if (num4 > num2)
                    {
                        num4 -= num2;
                        num2 = 0.0;
                    }
                    else
                    {
                        num2 -= num4;
                        num4 = 0.0;
                    }
                    vSlist[vSlist.Rows.Count - 1, 13] = num4;
                    vSlist[vSlist.Rows.Count - 1, 14] = num2;
                    LVYModule.SetColorForGrid(this.VSlist, Color.Khaki, vSlist.Rows.Count - 1, 0, 0, 0);
                }
                vSlist = null;
                num7 = Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[0]["TongSoDuNoDK"])) + Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[0]["TongSoPhatSinhNo"]));
                num6 = Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[0]["TongSoDuCoDK"])) + Conversion.Val(RuntimeHelpers.GetObjectValue(dataCongNoChiTietHanThanhToan.Rows[0]["TongSoPhatSinhCo"]));
                if (num7 > num6)
                {
                    num7 -= num6;
                    num6 = 0.0;
                }
                else
                {
                    num6 -= num7;
                    num7 = 0.0;
                }
                this.TxtTongPhatSinhNo.Value = num7;
                this.TxtTongPhatSinhCo.Value = num6;
                this.Cursor = Cursors.Default;
            }
        }

        private void TxtTuNgay_LostFocus(object sender, EventArgs e)
        {
            if (LVYModule.sRight(this.TxtTuNgay.Text, 7) != LVYModule.sRight(this.TxtDenNgay.Text, 7))
            {
                this.TxtDenNgay.Text = DateTime.DaysInMonth(Conversions.ToInteger(LVYModule.sRight(this.TxtTuNgay.Text, 4)), Conversions.ToInteger(LVYModule.sMid(this.TxtTuNgay.Text, 4, 2))).ToString() + "/" + LVYModule.sRight(this.TxtTuNgay.Text, 7);
            }
        }

        internal virtual ADVObjects AdvKhachHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvKhachHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvKhachHang = value;
            }
        }

        internal virtual ADVAccount AdvTaiKhoan
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvTaiKhoan;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvTaiKhoan = value;
            }
        }

        internal virtual System.Windows.Forms.Button CmdExel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExel_Click);
                if (this._CmdExel != null)
                {
                    this._CmdExel.Click -= handler;
                }
                this._CmdExel = value;
                if (this._CmdExel != null)
                {
                    this._CmdExel.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdLoad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdLoad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdLoad_Click);
                if (this._CmdLoad != null)
                {
                    this._CmdLoad.Click -= handler;
                }
                this._CmdLoad = value;
                if (this._CmdLoad != null)
                {
                    this._CmdLoad.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdPrint = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label16
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label16;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label16 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label5
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label5;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label5 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label6
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label6;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label6 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual Panel Panel3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel3 = value;
            }
        }

        internal virtual Panel Panel4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel4 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual C1NumericEdit TxtTongPhatSinhCo
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTongPhatSinhCo;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTongPhatSinhCo = value;
            }
        }

        internal virtual C1NumericEdit TxtTongPhatSinhNo
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTongPhatSinhNo;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTongPhatSinhNo = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtTuNgay_LostFocus);
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus -= handler;
                }
                this._TxtTuNgay = value;
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus += handler;
                }
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

